import axios from "axios";
import nprogress from "nprogress";
import "nprogress/nprogress.css";

const request = axios.create({
    baseURL:'/api',
    timeout:10000
})
// 添加请求拦截器
request.interceptors.request.use(function (config) {
    nprogress.start()
    return config;
  });

// 添加响应拦截器
request.interceptors.response.use(function (response) {
    nprogress.done()
    return response.data;
  }, function (error) {
    console.log(error);
    nprogress.done()
    return new Promise(()=>{})
  });


export default request